package me.xplabs.magic 
{
	import flash.display.BitmapData;
	import flash.utils.Dictionary;
	import flash.utils.getTimer;
	import me.xplabs.engine.display.BaseAnimate;
	import me.xplabs.model.skill.MSkillInfo;
	
	/**
	 * ...
	 * @author xiaohan
	 */
	public class MagicDisplay extends BaseAnimate 
	{
		public var resLib:Dictionary;
		public var skilInfo:MSkillInfo;
		private var _prevStatus:int;
		private var _curStatus:int;
		public function MagicDisplay() 
		{
			super();
			resLib = new Dictionary();
		}
		override public function update(container:BitmapData):void 
		{
			if (skilInfo)
			{
				x = skilInfo.curPosX;
				y = skilInfo.curPosY;
				changeStatus(1);
			}
			super.update(container);
		}
		private function changeStatus(status:int):void
		{
			_curStatus = status;
			if (_prevStatus == _curStatus || !resLib) return;
			sequence = resLib[_curStatus];
			_prevStatus = _curStatus;
		}
		
		override public function dispose():void 
		{
			super.dispose();
			_prevStatus = 0;
			_curStatus = 0;
			skilInfo = null;
			for (var name:String in resLib) 
			{
				delete resLib[name];
			}
		}
	}

}